﻿<UserControl x:Class="MainGameModule.Views.EventsJoinOrSupportView"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
             xmlns:converters="clr-namespace:MainGameModule.Views.Converters"
             mc:Ignorable="d"
             d:DesignHeight="420"
             d:DesignWidth="600"
             Width="700"
             Height="480">
    <UserControl.Resources>
        <ResourceDictionary>

            <ResourceDictionary.MergedDictionaries>
                <ResourceDictionary Source="/YourWorld.Common;component/Styles/CommonResourcesDictionary.xaml" />
            </ResourceDictionary.MergedDictionaries>

            <converters:BoolToVisibilityConverter x:Key="BoolToVisibilityConverter" />
            <converters:IntToVisibilityConverter x:Key="IntToVisibilityConverter" />
            <converters:IntToVisibilityReverseConverter x:Key="IntToVisibilityReverseConverter" />
            <Style x:Key="PlayersListBoxItemStyle"
                   TargetType="ListBoxItem">
                <Setter Property="Padding"
                        Value="3" />
                <Setter Property="HorizontalContentAlignment"
                        Value="Left" />
                <Setter Property="VerticalContentAlignment"
                        Value="Top" />
                <Setter Property="Background"
                        Value="Transparent" />
                <Setter Property="BorderThickness"
                        Value="0" />
                <Setter Property="TabNavigation"
                        Value="Local" />
                <Setter Property="Template">
                    <Setter.Value>
                        <ControlTemplate TargetType="ListBoxItem">
                            <Grid Background="{TemplateBinding Background}">
                                <VisualStateManager.VisualStateGroups>
                                    <VisualStateGroup x:Name="CommonStates">
                                        <VisualState x:Name="Normal" />
                                        <VisualState x:Name="MouseOver" />
                                        <VisualState x:Name="Disabled">
                                        </VisualState>
                                    </VisualStateGroup>
                                    <VisualStateGroup x:Name="SelectionStates">
                                        <VisualState x:Name="Unselected" />
                                        <VisualState x:Name="Selected">
                                        </VisualState>
                                    </VisualStateGroup>
                                    <VisualStateGroup x:Name="FocusStates">
                                        <VisualState x:Name="Focused">
                                        </VisualState>
                                        <VisualState x:Name="Unfocused" />
                                    </VisualStateGroup>
                                </VisualStateManager.VisualStateGroups>
                                <Rectangle x:Name="fillColor"
                                           Fill="#FFBADDE9"
                                           IsHitTestVisible="False"
                                           Opacity="0"
                                           RadiusY="1"
                                           RadiusX="1" />
                                <Rectangle x:Name="fillColor2"
                                           Fill="#FFBADDE9"
                                           IsHitTestVisible="False"
                                           Opacity="0"
                                           RadiusY="1"
                                           RadiusX="1" />
                                <ContentPresenter x:Name="contentPresenter"
                                                  ContentTemplate="{TemplateBinding ContentTemplate}"
                                                  Content="{TemplateBinding Content}"
                                                  HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
                                                  Margin="{TemplateBinding Padding}" />
                                <Rectangle x:Name="FocusVisualElement"
                                           RadiusY="1"
                                           RadiusX="1"
                                           Stroke="#FF6DBDD1"
                                           StrokeThickness="1"
                                           Visibility="Collapsed" />
                            </Grid>
                        </ControlTemplate>
                    </Setter.Value>
                </Setter>
            </Style>

        </ResourceDictionary>
    </UserControl.Resources>

    <Grid x:Name="LayoutRoot"
          Width="700"
          Height="480">
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto" />
            <RowDefinition Height="*" />
            <RowDefinition Height="Auto" />
            <RowDefinition Height="Auto" />
            <RowDefinition Height="Auto" />
        </Grid.RowDefinitions>

        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="*" />
            <ColumnDefinition Width="Auto" />
        </Grid.ColumnDefinitions>

        <Path x:Name="BackgroundRectangle"
              Grid.RowSpan="5"
              Grid.ColumnSpan="2"
              Data="M187.2383,141.7393C187.2383,141.7393,176.3913,144.7943,172.5713,149.0723C164.2383,158.4063,166.5713,209.7393,165.2383,221.7393C163.9053,233.7393,163.9053,364.4073,165.2383,397.0733C166.5713,429.7393,165.2383,441.7393,167.9053,452.4053C170.5713,463.0733,178.5713,462.4053,187.2383,465.7393C195.9053,469.0733,317.9053,475.0733,335.2383,475.0733C352.5713,475.0733,497.2383,476.4073,523.9053,475.0733C550.5723,473.7393,617.2393,476.4053,630.5723,469.7393C643.9053,463.0733,651.2383,452.4053,651.2383,435.7393C651.2383,419.0733,652.5713,301.0723,651.2383,249.0723C649.9053,197.0723,651.8313,159.3863,645.9053,150.4063C641.9333,144.3863,629.2383,143.7393,617.9053,141.7393C606.5723,139.7393,419.9053,137.7393,381.2383,138.4063C342.5713,139.0723,187.2383,141.7393,187.2383,141.7393z"
              Stretch="Fill">
            <Path.Effect>
                <DropShadowEffect Opacity="0.5" />
            </Path.Effect>
            <Path.Fill>
                <RadialGradientBrush RadiusX="0.8">
                    <GradientStop Color="#FFD1E778" />
                    <GradientStop Color="#FF4A6305"
                                  Offset="1" />
                </RadialGradientBrush>
            </Path.Fill>
        </Path>

        <Image Grid.RowSpan="2"
               Width="141"
               VerticalAlignment="Top"
               HorizontalAlignment="Left"
               Margin="-55,-48,0,-27"
               Source="images/questHeader.png" />

        <TextBlock Margin="10"
                   Grid.ColumnSpan="2"
                   FontFamily="Segoa UI"
                   FontSize="35"
                   Foreground="White"
                   FontWeight="ExtraBold"
                   Text="{Binding HeaderText}"
                   HorizontalAlignment="Center"
                   VerticalAlignment="Center" />
        <Button Style="{StaticResource CloseButtonStyle}"
                Grid.ColumnSpan="2"
                Command="{Binding CloseCommand}"
                Margin="0,10,10,0"
                d:LayoutOverrides="VerticalAlignment, GridBox" />


        <Image Width="180"
               Grid.Column="1"
               Margin="10"
               Grid.Row="1"
               Stretch="Uniform"
               Source="{Binding Quest.Image}"
               VerticalAlignment="Bottom" />

        <StackPanel x:Name="PlayerResponsePanel"
                    Grid.Row="1"
                    Margin="10"
                    Visibility="{Binding CanBuildObject, Converter={StaticResource BoolToVisibilityConverter}}"
                    VerticalAlignment="Bottom">
            <StackPanel Orientation="Horizontal">
                <TextBlock Text="        Hi, "
                           FontFamily="Segoa UI"
                           Foreground="White"
                           TextWrapping="Wrap"
                           FontWeight="Bold" />
                <TextBlock Text="{Binding OtherPlayerName}"
                           FontFamily="Segoa UI"
                           Foreground="White"
                           TextWrapping="Wrap"
                           FontWeight="Bold" />
            </StackPanel>
            <TextBlock FontFamily="Segoa UI"
                       Foreground="White"
                       TextWrapping="Wrap">
 	<Run Text="   You have made it! The quest - " />
	<Run Text="{Binding Quest.Name}" /> <Run Text=" is finally completed! And YOU were a part of it! This was a team quest, meaning that the exact number of players had to take it until it is finally completed." /> 
	<Run Text="You were the one who started it and therefore you are the one who will choose where should it be placed. From now on it will become a part of this map and everyone else will see it too. Taking quests is easy. When you earn experience you can initiate and take part in your friends quests! There are two main type of quests." />
	<LineBreak />	
    <Run Text="Below you see a list of the players who took part into this quest." />


            </TextBlock>
        </StackPanel>

        <StackPanel x:Name="QuestCompletedPanel"
                    Grid.Row="1"
                    Margin="10"
                    Visibility="{Binding IsQuestResponse, Converter={StaticResource BoolToVisibilityConverter}}"
                    VerticalAlignment="Bottom"
                    d:IsHidden="True">
            <StackPanel Orientation="Horizontal">
                <TextBlock Text="        Hi, "
                           FontFamily="Segoa UI"
                           Foreground="White"
                           TextWrapping="Wrap"
                           FontWeight="Bold" />
                <TextBlock Text="{Binding OtherPlayerName}"
                           FontFamily="Segoa UI"
                           Foreground="White"
                           TextWrapping="Wrap"
                           FontWeight="Bold" />
            </StackPanel>
            <TextBlock FontFamily="Segoa UI"
                       Foreground="White"
                       TextWrapping="Wrap">
 	<LineBreak />
 	<Run Text="   You have made it! The quest - " />
	<Run Text="{Binding Quest.Name}" /> <Run Text=" is finally completed! And YOU were a part of it! This was a team quest, meaning that the exact number of players had to take it until it is finally completed." /> 
	
	<Run Text="Taking quests is easy. When you earn experience you can initiate and take part in your friends quests! There are two main type of quests " />
	<LineBreak />
     <Run Text="Below you see a list of the players who took part into the quest. Maybe you'd like to connect with them and take other quests together... :)" />
            </TextBlock>


        </StackPanel>

        <ScrollViewer Grid.Column="0"
                      Grid.Row="2"
                      BorderThickness="0"
                      Style="{StaticResource ListBoxScrollViewerStyle}"
                      ScrollViewer.VerticalScrollBarVisibility="Visible"
                      ScrollViewer.HorizontalScrollBarVisibility="Disabled"
                      Margin="3,10,3,10">
            <ListBox ItemsSource="{Binding Members}"
                     MaxHeight="150"
                     Background="Transparent"
                     BorderThickness="0"
                     ScrollViewer.HorizontalScrollBarVisibility="Hidden"
                     ScrollViewer.VerticalScrollBarVisibility="Hidden"
                     ItemContainerStyle="{StaticResource PlayersListBoxItemStyle}">
                
                <ListBox.ItemTemplate>
                    <DataTemplate>
                        <Grid Margin="5,0,0,10">
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition Width="Auto" />
                                <ColumnDefinition Width="*" />
                                <ColumnDefinition Width="Auto" />
                            </Grid.ColumnDefinitions>

                            <Image Width="100"
                                   Height="100"
                                   Source="{Binding Image}" />
                            <StackPanel Grid.Column="1"
                                        Margin="5">

                                <TextBlock Text="{Binding Name}"
                                           Foreground="White"
                                           VerticalAlignment="Center"
                                           FontSize="12"
                                           FontWeight="Bold"
                                           FontFamily="Segoe UI" />

                                <StackPanel Margin="0"
                                            Orientation="Horizontal">
                                    <TextBlock Text="Level: "
                                               Foreground="White"
                                               VerticalAlignment="Center"
                                               FontSize="12"
                                               FontFamily="Segoe UI" />
                                    <ListBox ItemsSource="{Binding GameLevelCollectionWorkaround}"
                                             Background="Transparent"
                                             Margin="0"
                                             Padding="0"
                                             BorderBrush="Transparent"
                                             ItemContainerStyle="{StaticResource NoSelectionListBoxItemWOF}">
                                        <ListBox.ItemsPanel>
                                            <ItemsPanelTemplate>
                                                <StackPanel Orientation="Horizontal" />
                                            </ItemsPanelTemplate>
                                        </ListBox.ItemsPanel>
                                        <ListBox.ItemTemplate>
                                            <DataTemplate>
                                                <Image Source="images/game_level_medal.png"
                                                       Height="20"
                                                       Width="20" />
                                            </DataTemplate>
                                        </ListBox.ItemTemplate>
                                    </ListBox>
                                </StackPanel>

                                <StackPanel Margin="0"
                                            Orientation="Horizontal">
                                    <TextBlock Text="Badges: "
                                               VerticalAlignment="Center"
                                               Foreground="White"
                                               FontSize="12"
                                               FontFamily="Segoe UI" />
                                    <Grid>
                                        <TextBlock Text="No items."
                                                   HorizontalAlignment="Left"
                                                   VerticalAlignment="Center"
                                                   Foreground="White"
                                                   Visibility="{Binding BadgesCollection.Count, Converter={StaticResource IntToVisibilityReverseConverter}}"
                                                   FontSize="14"
                                                   FontFamily="Segoe UI" />
                                        <ScrollViewer Width="250"
                                                      Margin="0"
                                                      Padding="0"
                                                      Visibility="{Binding BadgesCollection.Count, Converter={StaticResource IntToVisibilityConverter}}"
                                                      BorderBrush="Transparent"
                                                      Style="{StaticResource ListBoxScrollViewerStyle}">
                                            <ListBox ItemsSource="{Binding BadgesCollection}"
                                                     Background="Transparent"
                                                     Margin="0"
                                                     Padding="0"
                                                     BorderBrush="Transparent"
                                                     ItemContainerStyle="{StaticResource NoSelectionListBoxItemWOF}">
                                                <ListBox.ItemsPanel>
                                                    <ItemsPanelTemplate>
                                                        <StackPanel Orientation="Horizontal"
                                                                    ScrollViewer.VerticalScrollBarVisibility="Hidden"
                                                                    ScrollViewer.HorizontalScrollBarVisibility="Auto" />
                                                    </ItemsPanelTemplate>
                                                </ListBox.ItemsPanel>
                                                <ListBox.ItemTemplate>
                                                    <DataTemplate>
                                                        <Image Source="{Binding Image}"
                                                               Height="40"
                                                               Width="40"
                                                               ToolTipService.ToolTip="{Binding Title}" />
                                                    </DataTemplate>
                                                </ListBox.ItemTemplate>
                                            </ListBox>
                                        </ScrollViewer>
                                    </Grid>
                                </StackPanel>

                                <StackPanel Margin="0"
                                            Orientation="Horizontal">
                                    <TextBlock Text="Quests: "
                                               VerticalAlignment="Center"
                                               Foreground="White"
                                               FontSize="12"
                                               FontFamily="Segoe UI" />
                                    <Grid>
                                        <TextBlock Text="No items."
                                                   HorizontalAlignment="Left"
                                                   VerticalAlignment="Center"
                                                   Foreground="White"
                                                   Visibility="{Binding QuestsCollection.Count, Converter={StaticResource IntToVisibilityReverseConverter}}"
                                                   FontSize="14"
                                                   FontFamily="Segoe UI" />
                                        <ScrollViewer Width="250"
                                                      Margin="0"
                                                      Padding="0"
                                                      BorderBrush="Transparent"
                                                      Visibility="{Binding QuestsCollection.Count, Converter={StaticResource IntToVisibilityConverter}}"
                                                      Style="{StaticResource ListBoxScrollViewerStyle}">
                                            <ListBox ScrollViewer.HorizontalScrollBarVisibility="Auto"
                                                     ScrollViewer.VerticalScrollBarVisibility="Disabled"
                                                     ItemsSource="{Binding QuestsCollection}"
                                                     Background="Transparent"
                                                     BorderBrush="Transparent"
                                                     Margin="0"
                                                     Padding="0"
                                                     ItemContainerStyle="{StaticResource NoSelectionListBoxItemWOF}">
                                                <ListBox.ItemsPanel>
                                                    <ItemsPanelTemplate>
                                                        <StackPanel Orientation="Horizontal"
                                                                    ScrollViewer.VerticalScrollBarVisibility="Hidden"
                                                                    ScrollViewer.HorizontalScrollBarVisibility="Hidden" />
                                                    </ItemsPanelTemplate>
                                                </ListBox.ItemsPanel>
                                                <ListBox.ItemTemplate>
                                                    <DataTemplate>
                                                        <Image Source="{Binding Image}"
                                                               Height="40"
                                                               Width="40"
                                                               ToolTipService.ToolTip="{Binding Title}" />
                                                    </DataTemplate>
                                                </ListBox.ItemTemplate>
                                            </ListBox>
                                        </ScrollViewer>
                                    </Grid>
                                </StackPanel>

                            </StackPanel>
                        </Grid>
                    </DataTemplate>
                </ListBox.ItemTemplate>

            </ListBox>
        </ScrollViewer>

        <TextBlock x:Name="QuestDescription"
				   Foreground="White"
                   Text="{Binding Quest.Description}"
                   Width="220"
                   Grid.Row="2"
                   Grid.Column="1"
                   Margin="11,2,11,20"
                   TextWrapping="Wrap" />


        <Button Grid.Row="4"
                Grid.ColumnSpan="2"
                Visibility="{Binding IsJoinQuestRequest, Converter={StaticResource BoolToVisibilityConverter}}"
                VerticalAlignment="Center"
                Content=" Join "
                Command="{Binding JoinCommand}"
                Style="{StaticResource GwButtonStyle}"
                Margin="0,5,0,20"
                HorizontalAlignment="Center"
                d:IsHidden="True" />

        <TextBlock Visibility="{Binding CanBuildObject, Converter={StaticResource BoolToVisibilityConverter}}"
                   Text="Well done! You have achived everything needed for completing this quest! Great job :)!"
                   TextWrapping="Wrap"
                   FontFamily="Segoa UI"
                   Foreground="White"
                   Grid.Row="4"
                   Grid.ColumnSpan="2"
                   HorizontalAlignment="Left"
                   Width="300"
                   Margin="40,6,0,0" />
        <Button Grid.Row="4"
                Grid.ColumnSpan="2"
                Visibility="{Binding CanBuildObject, Converter={StaticResource BoolToVisibilityConverter}}"
                VerticalAlignment="Center"
                Content=" Build "
                Command="{Binding BuildCommand}"
                Style="{StaticResource GwButtonStyle}"
                Margin="90,5,0,20"
                HorizontalAlignment="Center" />
        <Button Grid.Row="4"
                Grid.ColumnSpan="2"
                Visibility="{Binding IsQuestResponse, Converter={StaticResource BoolToVisibilityConverter}}"
                VerticalAlignment="Center"
                Content="   OK   "
                Command="{Binding CloseCommand}"
                Style="{StaticResource GwButtonStyle}"
                Margin="90,5,0,20"
                HorizontalAlignment="Center" />


    </Grid>
</UserControl>
